<template>
  <template v-for='(item, index) in menuData' :key='index'>
    <el-menu-item v-if='!Array.isArray(item.children)' :index='item.index'>
      <el-icon >
        <component :is="item.icon || 'edit'"/>
      </el-icon>
      <template #title>{{item.title}}</template>
    </el-menu-item>
    <el-sub-menu :index='Math.floor(Math.random()*1000000).toString()' v-else>
      <template #title>
				<el-icon >
					<component :is="item.icon || 'edit'"/>
				</el-icon>
        <span>{{item.title}}</span>
      </template>
      <MenuItem :menuData='item.children'/>
    </el-sub-menu>
  </template>
</template>

<script setup>

const props = defineProps({
  menuData: Array
})

</script>

<style scoped>

</style>
